home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fJoin
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Join Tables"
- ClientHeight = 1935
- ClientLeft = 3510
- ClientTop = 1935
- ClientWidth = 5835
- ControlBox = 0 'False
- Height = 2340
- Left = 3450
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1935
- ScaleWidth = 5835
- Top = 1590
- Width = 5955
- Begin CommandButton ClearJoinsButton
- BackColor = &H00C0C0C0&
- Caption = "C&lear All Joins"
- Height = 372
- Left = 2040
- TabIndex = 7
- Top = 1480
- Width = 1812
- End
- Begin CommandButton CloseButton
- BackColor = &H00C0C0C0&
- Cancel = -1 'True
- Caption = "&Close"
- Height = 372
- Left = 3960
- TabIndex = 6
- Top = 1480
- Width = 1812
- End
- Begin ListBox cFieldList2
- BackColor = &H00FFFFFF&
- Height = 1200
- Left = 3960
- TabIndex = 4
- Tag = "OLS"
- Top = 240
- Width = 1815
- End
- Begin ListBox cFieldList1
- BackColor = &H00FFFFFF&
- Height = 1200
- Left = 2040
- TabIndex = 3
- Tag = "OLS"
- Top = 240
- Width = 1815
- End
- Begin CommandButton AddJoinButton
- BackColor = &H00C0C0C0&
- Caption = "&Add Join to Query"
- Enabled = 0 'False
- Height = 372
- Left = 120
- TabIndex = 1
- Top = 1480
- Width = 1812
- End
- Begin ListBox cTableList
- BackColor = &H00FFFFFF&
- Height = 1200
- Left = 120
- MultiSelect = 1 'Simple
- TabIndex = 0
- Tag = "OLS"
- Top = 240
- Width = 1815
- End
- Begin Label FieldsLabel
- Alignment = 2 'Center
- BackColor = &H00C0C0C0&
- Caption = "Select Fields to Join Selected Tables on:"
- Height = 192
- Left = 2040
- TabIndex = 5
- Top = 0
- Width = 3732
- End
- Begin Label TableListLabel
- BackColor = &H00C0C0C0&
- Caption = "Select Table Pair:"
- Height = 192
- Left = 120
- TabIndex = 2
- Top = 0
- Width = 1812
- End
- Option Explicit
- Dim FTbl1 As String
- Dim FTbl2 As String
- Sub AddJoinButton_Click ()
- Dim i As Integer
- fQuery.cJoinFields.AddItem FTbl1 & "." & cFieldList1 & "=" & FTbl2 & "." & cFieldList2
- For i = 0 To cTableList.ListCount - 1
- cTableList.Selected(i) = False
- Next
- End Sub
- Sub cFieldList1_Click ()
- If Len(cFieldList2) > 0 Then
- AddJoinButton.Enabled = True
- End If
- End Sub
- Sub cFieldList2_Click ()
- If Len(cFieldList1) > 0 Then
- AddJoinButton.Enabled = True
- End If
- End Sub
- Sub ClearJoinsButton_Click ()
- fQuery.cJoinFields.Clear
- End Sub
- Sub CloseButton_Click ()
- Unload Me
- End Sub
- Sub cTableList_Click ()
- Dim i As Integer
- Dim t As TableDef
- FTbl1 = NULL_STR
- FTbl2 = NULL_STR
- cFieldList1.Clear
- cFieldList2.Clear
- For i = 0 To cTableList.ListCount - 1
- If cTableList.Selected(i) Then
- If Len(FTbl1) = 0 Then
- FTbl1 = cTableList.List(i)
- Else
- FTbl2 = cTableList.List(i)
- Exit For
- End If
- End If
- Next
- If Len(FTbl2) = 0 Then Exit Sub 'only one table selected
- Set t = gCurrentDB.TableDefs(FTbl1)
- For i = 0 To t.Fields.Count - 1
- cFieldList1.AddItem t.Fields(i).Name
- Next
- Set t = gCurrentDB.TableDefs(FTbl2)
- For i = 0 To t.Fields.Count - 1
- cFieldList2.AddItem t.Fields(i).Name
- Next
- End Sub
- Sub Form_Load ()
- Dim i As Integer
- For i = 0 To fQuery.cTableList.ListCount - 1
- If fQuery.cTableList.Selected(i) Then
- cTableList.AddItem fQuery.cTableList.List(i)
- End If
- Next
- Top = VDMDI.Top + fQuery.Top + fQuery.cCriteria.Top + 1300
- Left = fQuery.Left + 1500
- End Sub
- Sub Form_Paint ()
- Outlines Me
- End Sub
-